<?php

class Application_Form_Createnew extends Zend_Form {

    public function init() {
        $this->setMethod("post");

        #title
        $title = new Zend_Form_Element_Text('title');
        $title->setLabel("Enter Title:")
                ->setRequired()
                ->addFilter("StringTrim")
                ->setAttribs(array('class' => 'span12'));

        #desc
        $desc = new Zend_Form_Element_Textarea('description');
        $desc->setLabel("Enter Description:")
                ->setRequired()
                ->addFilter("StringTrim")
                ->setAttribs(array('class' => 'span12'));

        #images
        $photo = new Zend_Form_Element_File('photo');
        $photo->setLabel('Select Image:')
                ->addValidator('IsImage')
                ->addValidator('Extension', false, 'jpg,png,gif')
                ->setAttribs(array('multiple' => 'multiple'))
                ->setIsArray(true)
                ->setValueDisabled(true);

        #id
        $id = new Zend_Form_Element_Hidden('id');
        $id->setValue(0);

        #submit
        $submit = new Zend_Form_Element_Submit("submit");
        $submit->setLabel("Add")
                ->setAttribs(array('class' => 'btn btn-success'));

        #add elememnts
        $this->addElements(array($title, $desc, $photo, $id, $submit));
    }

}

